package test.ui {
	import gear.core.Game;
	import gear.log4a.Logger;
	import gear.log4a.UIAppender;
	import gear.net.AssetData;
	import gear.net.LibData;
	import gear.net.RESManager;
	import gear.net.SWFLoader;
	import gear.ui.controls.GToggleButton;
	import gear.ui.data.GToggleButtonData;

	import flash.display.MovieClip;
	import flash.events.Event;

	/**
	 * @author admin
	 */
	[SWF(width=550,height=400,backgroundColor=0x333333,frameRate=48)]
	public class TestGToggleButton extends Game {
		override protected function startup() : void {
			Logger.addAppender(new UIAppender(this));
			_res.add(new SWFLoader(new LibData("assets/ui.swf")));
			_res.addEventListener(Event.COMPLETE, completeHandler);
			_res.load();
		}

		private function completeHandler(event : Event) : void {
			_res.removeEventListener(Event.COMPLETE, completeHandler);
			addGToggleButton();
		}

		private function addGToggleButton() : void {
			var mc : MovieClip = RESManager.getMC(new AssetData("page_tb"));
			addChild(mc);
			var data : GToggleButtonData = new GToggleButtonData();
			data.bindTo(mc);
			data.x = 100;
			data.y = 20;
			data.labelData.text = "2";
			var tb : GToggleButton = new GToggleButton(data);
			addChild(tb);
		}
	}
}
